import java.util.Scanner;

public class Class1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int num =0;
        if (a==0&&b==0)
        {
            System.out.println(0);
            return;
        }
        if (Math.max(a,b)<=y){
            System.out.println(1);
            return;

        }
        if (x>=2*y){
            num += a/x;
            if (a%x!=0)
                num++;
            num += b/x;
            if (b%x!=0)
                num++;
            System.out.println(num);
            return;
        }
        if (x<=y){
            int max = Math.max(a,b);
            num += max/y;
            if (max%y!=0)
                num++;
            System.out.println(num);
            return;
        }
        int min = Math.min(a,b);
        while (min>=0){
            min-=y;
            num++;
        }
        int max =Math.max(a,b)-num*y;
        num +=max/x;
        if (max%x!=0)
            num++;
        System.out.println(num);




    }
}
